import React, {Component,Suspense} from 'react';
import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom';
import MyRote from './myRoute';
import Home from '@/view/home'
import Login from '@/view/login'

const routes = [
	{
		url: '/',
		title: '首页',
		component:'',
		children: [
			{
				url: 'login',
				title: '登录',
				
			}
		]
	}
]

//  function Login() {
// 	return (
// 		<div>
// 			login
// 		</div>
// 	)
// }

class index extends Component {
	render() {
		return (
			<BrowserRouter>
					<Suspense fallback={null}>
						<Switch>
							<Route path="/login" exact component={Login}></Route>
							<Route path="/404" exact component={()=><div>404</div>}></Route>
							<Route path="/"  render={() =>
								<Home>
									<Switch>
										<MyRote path="/" exact component={()=><div>666</div>}></MyRote>
										
										{/* <MyRote path="/" exact component={<div>666</div>}></MyRote> */}
										<Redirect from="/*" to="/404" />
									</Switch>
								</Home>}>
							</Route>
						</Switch>
					</Suspense>
			</BrowserRouter>
		);
	}
}

export default index;